import 'package:flutter/material.dart';
import 'package:flutter_cwhisky/common/style/colors.dart';
import 'package:flutter_cwhisky/component/app_bar/tools_bar.dart';
import 'package:flutter_cwhisky/component/base/base_state_less_view.dart';
import 'package:flutter_cwhisky/component/ink/ink_well_custom.dart';
import 'package:flutter_cwhisky/component/text_view.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

import '../../../common/theme_controller.dart';
import '../../../common/viewmodel/global_controller.dart';
import '../../../component/refresh/zv_refresh_widget.dart';
import 'cart_logic.dart';

class CartPage extends BaseStateLessView<CartLogic> {
  CartPage({super.key});

  @override
  Widget buildContent(BuildContext context) {
    // final glo = Get.find<ThemeController>();
    return Scaffold(
      appBar: ToolsBar(
        title: controller.cartCount > 0 ? '购物车(${controller.cartCount})' : '购物车',
        actions: [
          GetBuilder<GlobalController>(
            builder: (vm) {
              return InkWellCustom(
                child: Padding(
                  padding: EdgeInsets.only(right: 16.w),
                  child: Center(
                    child: TextView(text: controller.edited ? '完成' : '管理--${vm.cartCount}'),
                  ),
                ),
                onTap: () {
                  vm.updateCartCount(vm.cartCount + 1);
                },
              );
            },
          ),
        ],
      ),
      body: Container(
        child: ZvRefreshWidget(
          controller: controller.refreshController,
          onRefresh: () {},
          loadState: 1,
          child: Container(
            height: 1920,
            color: Colors.red,
          ),
        ),
      ),
    );
  }
}
